// pages/bookswaitreturned/bookswaitreturned.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    startdate: '2020-1-1',
    enddate: '2020-1-2',
    totaldays: null
  },
  methods: {
    // 开始时间选择事件
    startdatechange(e) {
      this.setData({
        startdate: e.detail.value
      })
      this.totaldays();
    },
    //截止时间选择事件
    enddatechange(e) {
      this.setData({
        enddate: e.detail.value
      })
      this.totaldays();
    },
    // 差值天数事件
    totaldays() {
      var start = (new Date((this.data.startdate.replace(/-/g, "/"))));
      var end = (new Date((this.data.enddate.replace(/-/g, "/"))));
      var days = parseInt((end.getTime() - start.getTime()) / (1000 * 60 * 60 * 24));
      this.setData({
        totaldays: days
      })
    },
    onLoad() {
      this.totaldays();
    },
    // 申请延期
    applydelay() {
      wx.navigateTo({
        url: '/pages/applydelay/applydelay',
      })
    }
  }
})